package com.puyuba.puyuba.utils.custommessage;

import android.content.Context;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hyphenate.chat.EMCustomMessageBody;
import com.hyphenate.easeui.widget.chatrow.EaseChatRow;
import com.puyuba.puyuba.R;
import com.puyuba.puyuba.network.Constants;

import java.util.Map;

public class SubmitNeedTxtNew extends EaseChatRow {
    private LinearLayout bubble;
    private TextView tvAge;
    private TextView tvPro;
    private TextView tvCompany;
    private TextView tvNeeds;
    private TextView tvYear;
    private LinearLayout bubble2;
    private TextView tvCurrentEdu;
    private TextView tvTargetEdu;
    private TextView tvTime;
    private TextView tvEasy;

    public SubmitNeedTxtNew(Context context, boolean isSender) {
        super(context, isSender);
    }

    @Override
    protected void onInflateView() {
        inflater.inflate(isSender ? R.layout.ease_submit_need_sent : R.layout.ease_submit_need_received, this);
    }

    @Override
    protected void onFindViewById() {
        bubble = (LinearLayout) findViewById(R.id.bubble);
        tvAge = (TextView) findViewById(R.id.tv_age);
        tvPro = (TextView) findViewById(R.id.tv_pro);
        tvCompany = (TextView) findViewById(R.id.tv_company);
        tvNeeds = (TextView) findViewById(R.id.tv_needs);
        tvYear = (TextView) findViewById(R.id.tv_year);
        bubble2 = (LinearLayout) findViewById(R.id.bubble2);
        tvCurrentEdu = (TextView) findViewById(R.id.tv_current_edu);
        tvTargetEdu = (TextView) findViewById(R.id.tv_target_edu);
        tvTime = (TextView) findViewById(R.id.tv_time);
        tvEasy = (TextView) findViewById(R.id.tv_easy);

    }

    @Override
    protected void onSetUpView() {
        EMCustomMessageBody txtBody = (EMCustomMessageBody) message.getBody();
        Map<String,String> params = txtBody.getParams();

        String type = params.get(Constants.TYPE);
        if (type.equals("zhiye")){
            //职业
            bubble.setVisibility(VISIBLE);
            bubble2.setVisibility(GONE);

            tvAge.setText(params.get(Constants.AGE));
            tvPro.setText(params.get(Constants.JOB));
            tvCompany.setText(params.get(Constants.COMPANY));
            tvNeeds.setText(params.get(Constants.INDUSTRY));
            tvYear.setText(params.get(Constants.YEAR));
        }else {
            //学历
            bubble.setVisibility(GONE);
            bubble2.setVisibility(VISIBLE);
            tvCurrentEdu.setText(params.get(Constants.NOW_EDU));
            tvTargetEdu.setText(params.get(Constants.AIM_EDU));
            tvTime.setText(params.get(Constants.YEAR));
            tvEasy.setText(params.get(Constants.DIFF_LEVEL));
        }
    }



}
